package com.itheima.weirpc.fault.retry;

import com.itheima.weirpc.spi.SpiLoader;

/**
 * ClassName: RetryStrategyFactory
 * Package: com.itheima.weirpc.fault.retry
 * Description:
 *  重试策略工厂（用于获取重试器对象）
 * @Author 看到风
 * @Create 2024/12/13 16:12
 * @Version 1.0
 */
public class RetryStrategyFactory {
    static {
        SpiLoader.load(RetryStrategy.class);
    }

    /**
     * 默认重试器
     */
    private static final RetryStrategy DEFAULT_RETRY_STRATEGY = new NoRetryStrategy();

    /**
     * 获取实例
     *
     * @param key
     * @return
     */
    public static RetryStrategy getInstance(String key) {
        return SpiLoader.getInstance(RetryStrategy.class, key);
    }

}
